<template>
  <div>
    <el-dialog
      v-model="dialogVisible"
      width="80%"
      align-center
      :show-close="false"
      destroy-on-close
      draggable
    >
      <template #header="{ close }">
        <div class="dialog-header flex justify-between items-center">
          <div>专家查看</div>
          <el-icon class="el-icon--left cursor-pointer" @click="close"
            ><CircleCloseFilled color="#fff"
          /></el-icon>
        </div>
      </template>
      <div class="bg-white mt-[10px] p-[10px]">
        <BaseTable>
          <tr>
            <td class="td-name">专家来源</td>
            <td>{{ detailData.expertSource == 1 ? "校内" : "校外" }}</td>
            <td class="td-name">姓名</td>
            <td>{{ detailData.name }}</td>
          </tr>
          <tr>
            <td class="td-name">职工号</td>
            <td>{{ detailData.account }}</td>
            <td class="td-name">工作单位</td>
            <td>{{ detailData.workUnit }}</td>
          </tr>
          <tr>
            <td class="td-name">性别</td>
            <td>
              <CommonLabel
                isFetch
                paramsName="人员-性别(男女)"
                labelKey="name"
                :value="detailData.sexId"
              />
            </td>
            <td class="td-name">出生日期</td>
            <td>{{ detailData.birthday }}</td>
          </tr>
          <tr>
            <td class="td-name">最后学历</td>
            <td>
              <CommonLabel isFetch paramsName="学历" :value="detailData.eduLevel" />
            </td>
            <td class="td-name">最后学位</td>
            <td>
              <CommonLabel
                isFetch
                paramsName="学位"
                labelKey="name"
                :value="detailData.eduDegree"
              />
            </td>
          </tr>
          <tr>
            <td class="td-name">统计归属</td>
            <td>
              <CommonLabel isFetch paramsName="教育部统计归属" :value="detailData.subjectClassId" />
            </td>
            <td class="td-name">一级学科</td>
            <td>{{ detailData.subjectName }}</td>
          </tr>
          <tr>
            <td class="td-name">职称</td>
            <td>{{ detailData.titleName }}</td>
            <td class="td-name">荣誉称号</td>
            <td>
              <CommonLabel isFetch paramsName="荣誉称号" :value="detailData.honorTitleId" />
            </td>
          </tr>
          <tr>
            <td class="td-name">手机号码</td>
            <td>{{ detailData.mobile }}</td>
            <td class="td-name">办公电话</td>
            <td>{{ detailData.telOffice }}</td>
          </tr>
          <tr>
            <td class="td-name">邮箱</td>
            <td>{{ detailData.email }}</td>
            <td class="td-name">研究方向</td>
            <td>{{ detailData.researchField }}</td>
          </tr>
        </BaseTable>
      </div>
      <template #footer>
        <div class="dialog-footer">
          <div class="operate-btns">
            <el-button type="primary" @click="dialogVisible = false">关闭</el-button>
          </div>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import BaseTable from "@/views/project/components/BaseTable.vue";
import CommonLabel from "@/views/project/components/CommonLabel.vue";
import { getExpertDetail } from "@/api/project/common";
const dialogVisible = ref(false);
const detailData = ref({});
const operateId = ref(null);
//查看
const view = (id) => {
  operateId.value = id;
  dialogVisible.value = true;
  getDetail();
};
const getDetail = async () => {
  const params = {
    id: operateId.value,
  };
  const res = await getExpertDetail(params);
  detailData.value = res.data[0];
};
defineExpose({ view });
</script>

<style scoped lang="scss">
@import url("@/views/project/index.scss");
</style>
